type ndetails =
  Node.ndetails =
    TimesNode
  | PlusNode
  | VarNode of int * int
  | ConstNode of float
  | NullNode
type node =
  Node.node = {
  hashid : int;
  mutable id : int;
  mutable parents : node list;
  mutable children : node list;
  mutable details : ndetails;
}
val hashid : node -> int
module NHashMap :
  sig
    type key = node
    type 'a t = 'a Node.NHashMap.t
    val create : int -> 'a t
    val clear : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val iter : (key -> 'a -> unit) -> 'a t -> unit
    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
    val length : 'a t -> int
  end
module NHashSet :
  sig
    type key = node
    type 'a t = 'a NHashMap.t
    val create : int -> 'a t
    val clear : 'a t -> unit
    val copy : 'a t -> 'a t
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val length : 'a t -> int
    val add : unit t -> key -> unit
    val iter : (key -> unit) -> unit t -> unit
    val fold : (key -> 'a -> 'a) -> unit t -> 'a -> 'a
    val to_list : unit t -> key list
    val sum_map : (key -> int) -> unit t -> int
    val sumf_map : (key -> float) -> unit t -> float
    val filter : (key -> bool) -> unit t -> unit
  end
module NSet :
  sig
    type key = node
    type 'a t = 'a NHashMap.t
    val create : int -> 'a t
    val clear : 'a t -> unit
    val copy : 'a t -> 'a t
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val length : 'a t -> int
    val add : unit t -> key -> unit
    val iter : (key -> unit) -> unit t -> unit
    val fold : (key -> 'a -> 'a) -> unit t -> 'a -> 'a
    val to_list : unit t -> key list
    val sum_map : (key -> int) -> unit t -> int
    val sumf_map : (key -> float) -> unit t -> float
    val filter : (key -> bool) -> unit t -> unit
  end
module NMap :
  sig
    type key = node
    type 'a t = 'a NHashMap.t
    val create : int -> 'a t
    val clear : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val iter : (key -> 'a -> unit) -> 'a t -> unit
    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
    val length : 'a t -> int
  end
val global_hashid : int ref
val gen_hashid : unit -> int
val null_node : node
val tmp_hash : unit NSet.t
val create_node : ndetails -> node list -> node
val ncopy : node -> node
val create_var : int -> int -> node
val create_const : float -> node
val create_times : node list -> node
val create_plus : node list -> node
val is_times : node -> bool
val is_plus : node -> bool
val is_var : node -> bool
val is_const : node -> bool
val is_null : node -> bool
val const_value : node -> float
val var_details : node -> int * int
val var_var : node -> int
val var_value : node -> int
val is_var_product : node -> bool
val is_sot_dist : node -> bool
val set_const : node -> float -> unit
val __add_parent : node -> node -> unit
val __remove_parent : node -> node -> unit
val add_child : node -> node -> unit
val remove_child : node -> node -> unit
val remove_all_children : node -> unit
val remove_all_parents : node -> unit
val unlink : node -> unit
val id : node -> int
val parents : node -> node list
val children : node -> node list
val num_children : node -> int
val node_name : node -> string
val node_name_hack : node -> string
val string_of_node : node -> string
val output_node : out_channel -> node -> unit
val print_node : node -> unit
val print_node_endline : node -> unit
val add_related :
  (NSet.key -> NSet.key list) -> unit NSet.t -> NSet.key -> unit
val relatedl : (NSet.key -> NSet.key list) -> NSet.key list -> unit NSet.t
val a_mem : 'a array -> node -> 'a
val add_related_a : (node -> node list) -> bool array -> node -> unit
val relatedl_a : int -> (node -> node list) -> node list -> bool array
val related : (NSet.key -> NSet.key list) -> NSet.key -> unit NSet.t
val ancestors : NSet.key -> unit NSet.t
val descendants : NSet.key -> unit NSet.t
val ancestorsl : NSet.key list -> unit NSet.t
val descendantsl : NSet.key list -> unit NSet.t
val move_parent_refs : node -> node -> unit
val node_iter : (NSet.key -> 'a) -> NSet.key -> unit
val node_map : (NSet.key -> 'a) -> NSet.key -> 'a list
val root_to_list : NSet.key -> NSet.key list
val prune_orphans : NSet.key -> unit
val prune_single_parents : NSet.key -> unit
val prune_single_children : NSet.key -> unit
type circuit = {
  schema : int array;
  vnodes : node array array;
  vnodes_l : node list array;
  flat_vnodes : node array;
  mutable nodes : node array;
  mutable root : node;
  mutable size : int;
}
val maxf : float -> float -> float
val logsumexp : float list -> float
val logsumexp2 : float -> float -> float
val string_of_schema : int array -> string
exception UnsupportedNodeType
val node_output_id : int -> node -> int
val node_input_index : int -> int -> int
val output : out_channel -> circuit -> unit
val output_js : out_channel -> circuit -> unit
val output_dot : out_channel -> circuit -> unit
val print : circuit -> unit
val output_node_rec :
  out_channel -> unit NHashSet.t -> int -> int -> NHashSet.key -> int
val output_root : out_channel -> int array -> NSet.key -> unit
val print_root : int array -> NSet.key -> unit
val schema : circuit -> int array
val numvars : circuit -> int
val node : circuit -> int -> node
val all_var_dists : circuit -> node list
val dist_var : node -> int
val all_vars : circuit -> node array array
val sibling_vars : circuit -> node -> node list
val var : circuit -> int -> node array
val flatten_vars : 'a array array -> 'a array
val flat_vars : circuit -> node array
val order : circuit -> unit
val make_vnodes : int array -> node array array
val __make_node_array : node list -> node array
val rebuild : circuit -> unit
val of_graph :
  int array -> node array array -> node list array -> node -> circuit
val of_graph2 : int array -> int array -> NSet.key -> circuit
val depth : circuit -> int
exception Unknown_child of string * string
val update_parents : circuit -> unit
val of_parse : int list * AcParseType.parsenode list -> circuit
val num_edges : circuit -> int
val num_params : circuit -> int
val create_evidence : circuit -> float array array
val create_evidence_s : int array -> float array array
val ev_true : float array array -> int -> int -> unit
val ev_false : float array array -> int -> int -> unit
val print_ev : float array array -> unit
val set_evidence : 'a array -> circuit -> 'a array array -> unit
val conditions_to_ev :
  int array -> (bool * int * int) array -> float array array
val example_to_ev : int array -> int array -> float array array
val ev_intersect : float array array -> float array array -> bool
val cond_intersect :
  int array -> (bool * int * int) array -> (bool * int * int) array -> bool
type condition = bool * int * int
type feature = {
  acnode : node;
  mutable weight : float;
  cond : condition list;
  ev : float array array;
}
val feature_node : feature -> node
val feature_value : feature -> float
val set_feature_value : feature -> float -> unit
val create_feature : int array -> node -> condition array -> feature
val input_features_lex : circuit -> Lexing.lexbuf -> feature list
val input_features : circuit -> in_channel -> feature list
val output_feature : out_channel -> (node -> int) -> feature -> unit
val output_feature_list :
  out_channel -> (node -> int) -> feature list -> unit
val output_with_features : out_channel -> circuit -> feature list -> unit
val create_scratch : circuit -> float array * int array array
val node_logvalue : float array -> node -> int array -> float
val logvalues : float array * int array array -> circuit -> float array
val loglikelihood_ev :
  float array * int array array -> circuit -> float array array -> float
val loglikelihood_x :
  float array * int array array -> circuit -> int array -> float
val logprob_ev :
  float array * int array array -> circuit -> float array array -> float
val logprob_x :
  float array * int array array -> circuit -> int array -> float
val compute_z : float array * int array array -> circuit -> float
val create_rec_scratch : circuit -> 'a option array
val node_logvalue_rec : float option array -> int array -> node -> float
val compute_node_logvalue_rec :
  float option array -> int array -> node -> float
val loglikelihood_rec : float option array -> circuit -> int array -> float
val compute_z_rec : float option array -> circuit -> float
val prune_for_evidence : circuit -> int array -> unit
val c_satisfied : int array -> bool * int * int -> bool
val f_satisfied : int array -> feature -> bool
val prune_features : feature list -> int array -> feature list
type deriv_scratch = {
  dr : float array;
  vr : float array;
  vr_nz : float array;
  bit1 : bool array;
  bit2 : bool array;
  cids : int array array;
}
val create_deriv_scratch : circuit -> deriv_scratch
val node_logvalue_dtopo : deriv_scratch -> int -> node -> unit
val d_upward_pass : circuit -> deriv_scratch -> float array array -> unit
val d_downward_pass : circuit -> deriv_scratch -> unit
val __print_ds : circuit -> deriv_scratch -> unit
val get_derivatives_raw :
  circuit -> deriv_scratch -> float array array -> unit
val get_logmarginals :
  circuit -> deriv_scratch -> int array -> float array array
val get_marginals :
  circuit -> deriv_scratch -> int array -> float array array
val node_logvalue_mpe : deriv_scratch -> int -> node -> unit
val mpe_upward_pass : circuit -> deriv_scratch -> float array array -> unit
val mpe_downward_pass : circuit -> deriv_scratch -> int -> unit
val get_mpe : circuit -> deriv_scratch -> int array -> int array
val input_schema : in_channel -> int array
val parse : in_channel -> int list * AcParseType.parsenode list
val load : in_channel -> circuit
exception NonConstantFeatureWeight of int
val load_with_features : in_channel -> circuit * feature list
